# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=linkfinder
pkgver=168.1debac5
pkgrel=5
pkgdesc='Discovers endpoint and their parameters in JavaScript files.'
arch=('any')
groups=('blackarch' 'blackarch-webapp' 'blackarch-recon')
url='https://github.com/GerbenJavado/LinkFinder'
license=('custom:unknown')
depends=('python' 'python-argparse' 'python-jsbeautifier')
makedepends=('git')
source=("$pkgname::git+https://github.com/GerbenJavado/LinkFinder.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd "$pkgname"

  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 755 -t "$pkgdir/usr/share/$pkgname/" *.py
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" *.html
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python3 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

